import { mapGetters } from 'vuex'
export default {
  data () {
    return {
      policeEchart: null,
      warningSourceEchartList: [],
      policeOption: {
        tooltip: {
          trigger: 'item'
        },
        series: [
          {
            name: '',
            type: 'pie',
            radius: ['40%', '80%'],
            center: ['50%', '60%'],
            itemStyle: {
              borderWidth: 1,
              borderColor: '#fff'
            },
            data: [],
            color: ['#1fadff', '#afe551', '#cbf1f4', '#54d460', '#9f81ff', '#abd454', '#d4c054', '#d49054', '#54a8d4', '#546fd4', '#7e54d4', '#b154d4', '#5472d4'],
            label: {
              formatter: '{b|{b}，}{d|{c}}',
              rich: {
                b: {
                  fontSize: 14,
                  color: '#949494',
                  align: 'center'
                },
                d: {
                  fontSize: 14,
                  color: '#333',
                  align: 'left'
                }
              }
            }
          }
        ]
      }
    }
  },
  methods: {
    initWarningSource () {
      this.warningSourceEchartList = []
      this.warningSourceEchartList.push({value: this.deviceDustWorkSum.dustcount || 0, name: '扬尘'})
      this.warningSourceEchartList.push({value: this.deviceDustWorkSum.tempcount || 0, name: '温度'})
      this.warningSourceEchartList.push({value: this.deviceDustWorkSum.noisecount || 0, name: '噪音'})
      this.policeOption.series[0].data = this.warningSourceEchartList
      this.policeEchart = this.$Echarts.init(this.$refs.police)
      this.policeEchart.setOption(this.policeOption)
    }
  }
}
